package servicesImp.staff;

import base.IBaseMapperWithoutBLOBs;
import base.IBaseServicesWithoutBLOBsImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import services.staff.StaffInfoServices;
import wt.dao.staff.StaffInfoMapper;
import wt.entity.staff.StaffInfo;
import wt.entity.staff.StaffInfoExample;
import wt.staticData.TableName;

import java.util.List;

/**
 * Created by Administrator on 2017/12/11.
 */
@Service
public class StaffInfoInfoServicesImp extends IBaseServicesWithoutBLOBsImpl<StaffInfo,StaffInfoExample> implements StaffInfoServices {
    @Autowired
    StaffInfoMapper staffInfoMapper;

    @Override
    public IBaseMapperWithoutBLOBs<StaffInfo, StaffInfoExample> getMapper() {
        return staffInfoMapper;
    }

    @Override
    public String getTableName() {
        return TableName.SMS_STAFF_INFO;
    }

    public StaffInfo selectByUserId(String userId) throws Exception {
        StaffInfoExample  staffInfoExample=new StaffInfoExample();
        staffInfoExample.createCriteria().andUserIdEqualTo(userId);
        List<StaffInfo> staffInfoList=selectByExample(staffInfoExample);
        if (staffInfoList.isEmpty()){
            return  null;

        }else {
            return staffInfoList.get(0);
        }
    }
}
